#Requires AutoHotkey v2.0
#Include "func.ahk"

; 服务
if (pm_scoop = true) {
;	Run SCOOP_GLOBAL . "postgresql\current\bin\pg_ctl -D " . SCOOP_GLOBAL . "postgresql\current\data -l " . SCOOP_GLOBAL . "postgresql\current\data\postgres.log start", , "Hide"
;	Run SCOOP_GLOBAL . "parsec-vdd-cli\current\parsec-vdd-cli.bat", SCOOP_GLOBAL . "parsec-vdd-cli\current", "Hide"
;	Run SCOOP_GLOBAL . "sunshine\current\sunshine.exe", SCOOP_GLOBAL . "sunshine\current", "Hide"
;	Run SCOOP_GLOBAL . "emacs\current\bin\runemacs.exe --daemon", SCOOP_GLOBAL . "emacs\current", "Hide"
;	Run SCOOP_GLOBAL . "ultravnc\current\winvnc.exe", SCOOP_GLOBAL . "ultravnc\current", "Hide"
	Run SCOOP_GLOBAL . "syncthingtray\current\syncthingtray.exe", SCOOP_GLOBAL . "syncthingtray\current", "Hide"
	Run SCOOP_GLOBAL . "thunderbird\current\thunderbird.exe", SCOOP_GLOBAL . "thunderbird\current", "Min"
;	Run SCOOP_GLOBAL . "siyuan-unlock\current\SiYuan.exe", SCOOP_GLOBAL . "siyuan-unlock\current", "Min"
	Run SCOOP_GLOBAL . "xmousebuttoncontrol\current\XMouseButtonControl.exe", SCOOP_GLOBAL . "xmousebuttoncontrol\current"
	Run SCOOP_GLOBAL . "eartrumpet\current\EarTrumpet.exe", SCOOP_GLOBAL . "eartrumpet\current"
	Run SCOOP_GLOBAL . "kdeconnect\current\bin\kdeconnect-app.exe", SCOOP_GLOBAL . "kdeconnect\current\bin", "Hide"
	Run SCOOP_GLOBAL . "v2rayn\current\v2rayN.exe", SCOOP_GLOBAL . "v2rayn\current", "Hide"
	Run SCOOP_GLOBAL . "everything\current\everything.exe", SCOOP_GLOBAL . "everything\current"
	Run SCOOP_GLOBAL . "copyq\current\copyq.exe", SCOOP_GLOBAL . "copyq\current"
	Run SCOOP_GLOBAL . "7tt\current\7+ Taskbar Tweaker.exe", SCOOP_GLOBAL . "7tt\current", "Hide"
;	Run SCOOP_GLOBAL . "qtox\current\qtox.exe", SCOOP_GLOBAL . "qtox\current"
;	Run SCOOP_GLOBAL . "snipaste\current\Snipaste.exe", SCOOP_GLOBAL . "snipaste\current"
	Run SCOOP_GLOBAL . "pixpin\current\PixPin.exe", SCOOP_GLOBAL . "pixpin\current"
	Run SCOOP_GLOBAL . "traymond\current\Traymond.exe", SCOOP_GLOBAL . "traymond\current", "Hide"
	Run SCOOP_GLOBAL . "powertoys\current\PowerToys.exe", SCOOP_GLOBAL . "powertoys\current", "Hide"
	Run SCOOP_GLOBAL . "switchhosts\current\SwitchHosts.exe", SCOOP_GLOBAL . "switchhosts\current", "Hide"
;	Run SCOOP_GLOBAL . "keyviz\current\keyviz.exe", SCOOP_GLOBAL . "keyviz\current"
	Run SCOOP_GLOBAL . "wechat\current\WeChat.exe", SCOOP_GLOBAL . "wechat\current"
;	Run SCOOP_GLOBAL . "wechat\current\WeChat.exe", SCOOP_GLOBAL . "wechat\current"
;	Run SCOOP_GLOBAL . "calibre\current\calibre-portable.exe", SCOOP_GLOBAL . "calibre\current"
;	Run SCOOP_GLOBAL . "audioshare-cmd\current\as-cmd.bat", SCOOP_GLOBAL . "audioshare-cmd\current"
}
if DirExist(rime) {
	Run rime . "WeaselServer.exe", rime
}

; 应用
;; 应用列表，首个值是应用相对程序的子目录，第二个值是应用启动器文件名
appList := [
	["Docker\Docker", "Docker Desktop.exe"],
	["DingDing", "DingtalkLauncher.exe"],
	["feishu", "Feishu.exe"],
	["youdao\Dict", "YoudaoDict.exe"],
	["Tencent\QQNT", "QQ.exe"],
	["aliworkbench", "AliWorkbench.exe"]
]

; 遍历应用列表，启动应用。索引从1开始
for index, app in appList {
	; 查找应用路径
	if appPath := findAppPath(app[1]) {
		; 若找到路径则运行程序
		Run appPath . app[2], appPath
	}
}
